﻿namespace MES_SystemUI.Migrations
{
    using System;
    using System.Data.Entity.Migrations;
    
    public partial class addMaterial : DbMigration
    {
        public override void Up()
        {
            CreateTable(
                "dbo.MaterialCategories",
                c => new
                    {
                        MaterialCategorieId = c.Int(nullable: false, identity: true),
                        MaterialCategorieName = c.String(nullable: false, maxLength: 20, unicode: false),
                        Status = c.Int(nullable: false),
                        CteateUserId = c.Int(nullable: false),
                        CreateTime = c.DateTime(nullable: false),
                        LastUpdateUserId = c.Int(),
                        LastUpdateTime = c.DateTime(),
                    })
                .PrimaryKey(t => t.MaterialCategorieId);
            
            CreateTable(
                "dbo.MaterialDetails",
                c => new
                    {
                        MaterialDetailId = c.Int(nullable: false, identity: true),
                        MaterialId = c.Int(nullable: false),
                        MaterialDetailSpecId = c.Int(nullable: false),
                        MaterialDetailTexture = c.String(nullable: false, maxLength: 20, unicode: false),
                        MaterialDetailUnitId = c.Int(nullable: false),
                        MaterialDetailCount = c.Int(nullable: false),
                        MaterialDetailSectionShape = c.String(maxLength: 20, unicode: false),
                        MaterialDetailCategorieId = c.Int(nullable: false),
                        MaterialDetailWeight = c.Int(),
                        MaterialDetailLength = c.Int(),
                        MaterialDetailThickness = c.Int(),
                        StoreId = c.Int(nullable: false),
                        Status = c.Int(nullable: false),
                        CteateUserId = c.Int(nullable: false),
                        CreateTime = c.DateTime(nullable: false),
                        LastUpdateUserId = c.Int(),
                        LastUpdateTime = c.DateTime(),
                    })
                .PrimaryKey(t => t.MaterialDetailId);
            
            CreateTable(
                "dbo.Materials",
                c => new
                    {
                        MaterialId = c.Int(nullable: false, identity: true),
                        MaterialName = c.String(nullable: false, maxLength: 20, unicode: false),
                        MaterialCode = c.String(nullable: false, maxLength: 20, unicode: false),
                        Status = c.Int(nullable: false),
                        CteateUserId = c.Int(nullable: false),
                        CreateTime = c.DateTime(nullable: false),
                        LastUpdateUserId = c.Int(),
                        LastUpdateTime = c.DateTime(),
                    })
                .PrimaryKey(t => t.MaterialId);
            
            CreateTable(
                "dbo.MaterialSpecs",
                c => new
                    {
                        MaterialSpecId = c.Int(nullable: false, identity: true),
                        MaterialSpecName = c.String(nullable: false, maxLength: 20, unicode: false),
                        Status = c.Int(nullable: false),
                        CteateUserId = c.Int(nullable: false),
                        CreateTime = c.DateTime(nullable: false),
                        LastUpdateUserId = c.Int(),
                        LastUpdateTime = c.DateTime(),
                    })
                .PrimaryKey(t => t.MaterialSpecId);
            
        }
        
        public override void Down()
        {
            DropTable("dbo.MaterialSpecs");
            DropTable("dbo.Materials");
            DropTable("dbo.MaterialDetails");
            DropTable("dbo.MaterialCategories");
        }
    }
}
